package com.niiwoo.civet.user.enums;

import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * face++肖像认证状态 1-初始化 2-需人工审核 3-通过 4-不通过 5-渠道异常
 */
@Getter
@AllArgsConstructor
public enum FacePlusAuditStatusEnum {

    INIT((byte) 1, "初始化"),
    NEED_AUDIT((byte) 2, "需人工审核"),
    SUCCESS((byte) 3, "通过"),
    FAILURE((byte) 4, "不通过"),
    SERVER_EXCEPTION((byte) 5, "渠道异常"),
    REVIEW((byte) 6, "待审核"),
    DISCARDED((byte) 7, "丢弃");

    private Byte value;

    private String desc;

    public static FacePlusAuditStatusEnum of(byte value) {
        for (FacePlusAuditStatusEnum t : values()) {
            if (t.value == value) {
                return t;
            }
        }
        return null;
    }

    public static boolean except(Byte value, FacePlusAuditStatusEnum... status) {
        return (status != null && status.length > 0) && Arrays.asList(status).contains(of(value));
    }

}
